package com.markerhub.pojo.dto;

import com.markerhub.vo.WxUserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

/**
 * @Author by MaXiaofeng
 * @Description TODO
 * @Date 2022/2/9 16:33
 * @Version 1.0.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private long id;
    private String openid;
    private String nickname;//用户昵称
    private String avatarurl;//用户头像
    private int gender;//性别
    private String country;//所在国家
    private String province;//省份
    private String city;//城市
    private String language;//语言
    private Timestamp ctime;//创建时间
    private int telnum;//手机号码
    private String wx_union_id;//微信union_id
    private String token;

    public void from(WxUserInfo wxUserInfo) {
        this.nickname = wxUserInfo.getNickName();
        this.gender = wxUserInfo.getGender();
        this.openid = wxUserInfo.getOpenId();
        this.wx_union_id = wxUserInfo.getUnionId();
        this.language = wxUserInfo.getLanguage();
        this.avatarurl = wxUserInfo.getAvatarUrl();
    }
}
